import threading
import time

start_time = time.time()


def run_th(url):
    for i in range(10):
        print("thread", url)


# 主程序
if __name__ == '__main__':
    print("主线程")
    # 指定了10个线程，其中是11个线程，其中1个主线程
    for i in range(10):
        # 单线程运行
        # run()
        # t = threading.Thread(target=run, args=("", ))
        t = threading.Thread(target=run_th("https://www.baidu.com"))
        t.start()

    while threading.active_count() != 1:
        pass

    print(threading.active_count())
    end_time = time.time()
    print("运行时间：", end_time - start_time)